using AppToolKit.Core.Text;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace AppToolKit.Model.Validation
{
	[Serializable]
	public class ValidateResultSet : ISerializable
	{
		private List<ValidateResult> resuls_;
		public bool IsValid
		{
			get
			{
				return this.resuls_ == null || this.resuls_.Count <= 0;
			}
		}
		public List<ValidateResult> Resuls
		{
			get
			{
				if (this.resuls_ == null)
				{
					this.resuls_ = new List<ValidateResult>();
				}
				return this.resuls_;
			}
			set
			{
				this.resuls_ = value;
			}
		}
		public void AddResult(ValidateResult result)
		{
			this.Resuls.Add(result);
		}
		public void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			info.AddValue("results", this.resuls_, typeof(List<ValidateResult>));
		}
		public ValidateResultSet(SerializationInfo info, StreamingContext context)
		{
			this.resuls_ = (info.GetValue("results", typeof(List<ValidateResult>)) as List<ValidateResult>);
		}
		public ValidateResultSet()
		{
		}
		public string GetError()
		{
			string result;
			if (this.resuls_ != null)
			{
				List<string> list = new List<string>();
				foreach (ValidateResult current in this.resuls_)
				{
					list.Add(current.message);
				}
				result = string.Join(Tag.LineEnd, list.ToArray());
			}
			else
			{
				result = string.Empty;
			}
			return result;
		}
	}
}
